using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MbUnit.Framework;

namespace Frost {
    public class TestRunner {
        
        public TestRunner(ITestRepository testRepository, 
                            ITestStrategyService testStrategies,
                            ITestEnvironment testEnvironment
            ) {
            TestRepository = testRepository;
            TestStrategyService = testStrategies;
            TestEnvironment = testEnvironment;
            Tests = new List<ITest>();
        }

        public void SetupTestRun() {
            Tests = TestRepository.GetTests();
        }

        public void RunTests() {
            foreach (var test in Tests) {
                var strategy = TestStrategyService.GetTestStrategy(test);
                strategy.RunTest(test);                
            }
        }

        public ITestEnvironment TestEnvironment { get; private set; }
        public IEnumerable<ITest> Tests { get; private set; }
        public ITestRepository TestRepository { get; private set; }
        public ITestStrategyService TestStrategyService { get; private set; }
    }
}
